﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Models
{
    public class PokerTable
    {
        public PokerTable()
        {
            this.TableActionButtons = new TableActionButtons();
            this.HoleCards = new HoleCards();
            this.BoardCards = new BoardCards();
            this.Blinds = new Blinds();
        }

        public Blinds Blinds { get; set; }

        private string _tableName;
        public string TableName
        {
            get { return _tableName; }
            set
            {
                AdjustBlinds(value);
                _tableName = value;
            }
        }

        private void AdjustBlinds(string value)
        {
            string tableNameEnds = value.Split('-')[2];
            tableNameEnds = tableNameEnds.Replace("$", "");
            string[] blindsString = tableNameEnds.Split('/');
            this.Blinds.SmallBlind = decimal.Parse(blindsString[0]);
            this.Blinds.BigBlind = decimal.Parse(blindsString[1]);
        }

        public bool IsMyTurn { get; set; }

        public decimal Pot { get; set; }

        public int OpponentsCount { get; set; }

        public TableActionButtons TableActionButtons { get; set; }

        public HoleCards HoleCards { get; set; }

        public BoardCards BoardCards { get; set; }

        public TableState TableState { get; set; }

        public double HeroWinRate { get; set; }

        public double VilliansWinRate { get; set; }

        public TableAction Action { get; set; }
    }
}
